package org.example.poi.EasyExcel;

import com.alibaba.excel.EasyExcel;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class TWO {
    public static void main(String[] args) throws FileNotFoundException {
        List<ExcelVO> list = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            ExcelVO excelVO = new ExcelVO();
            excelVO.setName("张三" + i);
            excelVO.setPark("停车场" + i);
            excelVO.setNumber("车牌号" + i);
            excelVO.setType("支付类型" + i);
            excelVO.setMoney(i);
            excelVO.setTime(new Date());
            list.add(excelVO);
        }
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\1.xlsx");
        EasyExcel.write(fileOutputStream)
                .head(ExcelVO.class)
                .sheet("Sheet1")
                .registerWriteHandler(new CustomCellWriteHandle())
                .doWrite(list);
    }
}
